//
//  EventViewInTopViewInWeekView.swift
//  YOKO
//
//  Created by Zoe_G on 16/5/27.
//  Copyright © 2016年 15Tec. All rights reserved.
//

import UIKit

class EventViewInTopViewInWeekView: UIView {

    var eventColor: Int!
    var titleLabel = UILabel()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        self.backgroundColor = UIColor.whiteColor()
//        self.backgroundColor = UIColor.clearColor()
        self.layer.shadowOffset = CGSizeMake(0, 1)
        self.layer.shadowColor = UIColor.lightGrayColor().CGColor
        self.layer.shadowRadius = 2
        self.layer.shadowOpacity = 0.4
//        
//        self.layer.cornerRadius = 2.0
//        self.layer.masksToBounds = true
        
        setNeedsDisplay()
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        
        setNeedsDisplay()
    }
    
    override func drawRect(rect: CGRect) {
//        UIBezierPath.init(roundedRect: rect, cornerRadius: 2.0).addClip()

        //画左边的颜色条
        DrawUtil.drawLine(CGPointMake(1.0, 0), end: CGPointMake(1.0, self.frame.height), withColor: YOKOColor.TypeColors[eventColor], withWidth: 3.0)
        //title
        titleLabel.textColor = YOKOColor.fontBlack
        titleLabel.frame = CGRectMake( 4.0, 0, self.frame.width-4.0, self.frame.height)
        titleLabel.font = UIFont.systemFontOfSize(8.0)
        self.addSubview(titleLabel)
        
    }

}
